using System;
using System.Data;
using System.Xml;
using vs.Authentication;
using vs.Core;

namespace Forum
{
    public partial class forum_home : vs.Core.Window
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    lnkAdmin.NavigateUrl = UrlProvider.AdminUrl("fr_forum", "admin");
                    lnkAdmin.Visible = Authenticate.IsAdmin;

                    string forumdesk = this.GetModuleSetting("forumdesk");
                    string topicdesk = this.GetModuleSetting("topicdesk");

                    engine_xml engine = new engine_xml();
                    if (forumdesk != "")
                    {
                        XmlDocument doc = engine.HomeXML(forumdesk, topicdesk);
                        string skin = ModSettingController.GetModuleSetting("skin", Utils.ModuleID);
                        string template = engine_xml.get_template_folder(skin) + "forum_home.xsl";
                        CommonFunction.XMLTransform(xmlTransformer, template, doc);
                    }
                    else
                    {
                        Response.Write("Admin phai dat lai thong so 'forumdesk'");
                    }
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
            }
        }
    }
}